package com.netease.easyexcel.web;

import com.netease.easyexcel.service.ExcelParser;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

import javax.annotation.Resource;

@RestController
@RequestMapping("/api")
public class ExcelController {

    @Resource
    private ExcelParser excelParser;

    @PostMapping("/import")
    public void importExcel(@RequestParam("serviceId") String serviceId,
                            @RequestParam("ideVersion") String ideVersion,
                            @RequestParam("xlsxFle") MultipartFile[] xlsxFiles){
        System.out.println("导入xlsx文件");
        System.out.println(xlsxFiles.length);
        excelParser.importByExcelFile(serviceId,ideVersion,xlsxFiles);
    }

}
